package CollectionTest.CollectionTest;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo2 {
    public static void main(String[] args) {

        //1.创建集合对象
        Collection<Student> coll = new ArrayList<Student>();

        //2.创建学生对象
        Student s1 = new Student("zhangsan",23);
        Student s2 = new Student("lisi",24);
        Student s3 = new Student("wangwu",25);

        //3.把学生对象添加到集合中
        coll.add(s1);
        coll.add(s2);
        coll.add(s3);

        //4.判断集合中是否包含学生4
        Student s4 = new Student("zhangsan",23);

        //需要再javabean中重写Contains
        System.out.println(coll.contains(s4));

    }
}
